From: Keir Fraser Date: Fri, 13 Jun 2008 08:56:49 +0000 (+0100) Subject: hvm: Fix max_mapped_pfn when using 2MB super pages. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14192^2~77 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4565fb811d5eeaed34c870ec193050ed45ea6aeb;p=xen.git hvm: Fix max_mapped_pfn when using 2MB super pages. Fixes booting Linux guest allocated more than 4G memory. - The p2m table will track the max_mapped_pfn, and while doing p2m_gfn_to_mfn(), if the gfn is higher than max_mapped_pfn, the function will return _mfn(INVALID_MFN). This makes the Linux guest kernel panic. Signed-off-by: Xu Dongxiao --- diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 9311bde126..dba676d57a 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -323,7 +323,7 @@ p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, /* Track the highest gfn for which we have ever had a valid mapping */ if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) ) - d->arch.p2m->max_mapped_pfn = gfn; + d->arch.p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1; if ( iommu_enabled && (is_hvm_domain(d) || need_iommu(d)) ) {